package com.ruoyi.web.controller.vantController.teamController;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.construction.CaseInfo;
import com.ruoyi.system.domain.zhuangxiumain.shopMain.BrandInfo;
import com.ruoyi.system.service.vantservice.teamservice.ApiCaseInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@Api(value = "建房案例接口", tags = {"建房案例接口"})
@RestController
@RequestMapping("/api/team/caseinfo")
@CrossOrigin
public class ApiCaseInfoController extends BaseController {

    @Autowired
    private ApiCaseInfoService apiCaseInfoService;

    @ApiResponses({@ApiResponse(code = 200, message = "正常", response = BrandInfo.class)})
    @ApiOperation(value = "建房案例全部信息")
    @GetMapping("/findAllList")
    public TableDataInfo list(CaseInfo caseInfo)
    {
        startPage();
        List<CaseInfo> list = apiCaseInfoService.selectCaseInfoList(caseInfo);
        return getDataTable(list);
    }

    /**
     * 获取施工案例详细信息
     */
    @ApiResponses({@ApiResponse(code = 200, message = "正常", response = BrandInfo.class)})
    @ApiOperation(value = "获取施工案例详细信息")
    @GetMapping(value = "/findAllById/{caseId}")
    public AjaxResult getInfo(@PathVariable("caseId") Integer caseId)
    {
        return AjaxResult.success(apiCaseInfoService.selectCaseInfoById(caseId));
    }


    @ApiResponses({@ApiResponse(code = 200, message = "正常", response = BrandInfo.class)})
    @ApiOperation(value = "根据ID查询施工案例信息")
    @GetMapping(value = "/getId/{constructionId}")
    public AjaxResult getId(@PathVariable("constructionId") Long constructionId)
    {
        System.err.println("**********1111111111111111111");
        return AjaxResult.success(apiCaseInfoService.getId(constructionId));
    }

    @ApiResponses({@ApiResponse(code = 200, message = "正常", response = BrandInfo.class)})
    @ApiOperation(value = "根据ID查询施工案例信息")
    @GetMapping(value = "/getCaseId/{constructionId}")
    public List<CaseInfo> getCaseId(@PathVariable("constructionId") Long constructionId)
    {
        return apiCaseInfoService.getCaseId(constructionId);
    }


    @ApiResponses({@ApiResponse(code = 200, message = "正常", response = BrandInfo.class)})
    @ApiOperation(value = "根据ID查询施工案例详情")
    @GetMapping(value = "/getParticularsId/{caseId}")
    public AjaxResult getParticularsId(@PathVariable("caseId") Integer caseId)
    {
        return AjaxResult.success(apiCaseInfoService.getParticularsId(caseId));
    }


}
